def solve(nums):
    n = len(nums)
    dp = list([0] * n)
    dp[0] = nums[0]
    for i in range(1, n):
        if dp[i - 1] < i:
            return False
        else:
            dp[i] = max(dp[i - 1], i + nums[i])

    if dp[n - 1] < n - 1:
        return False
    else:
        return True


if __name__ == "__main__":
    nums = [0, 3, 1, 1, 4]
    print(solve(nums))
